import { MidwayConfig } from '@midwayjs/core';

export default {
  // use for cookie sign key, should change to your own and keep security
  keys: '1748354780751_5595',
  koa: {
    port: 7001,
  },
  middleware: ['cors'],
  cors: {
    enable: true,
    origin: 'http://localhost:3000',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
    allowHeaders: ['Content-Type', 'Authorization', 'Accept'],
    exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],
    maxAge: 5,
    credentials: true,
    keepHeadersOnError: true
  },
  mysql: {
    client: {
      host: 'localhost',
      user: 'root',
      password: '123456',
      database: 'test',
      waitForConnections: true,
      connectionLimit: 10,
      queueLimit: 0,
      timezone: '+08:00'  // 新增：设置时区为北京时间
    },
  },
} as MidwayConfig;
